﻿<UserControl
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:UIElements="clr-namespace:TfsWorkbench.UIElements;assembly=TfsWorkbench.UIElements"
    xmlns:TaskBoardUI="clr-namespace:TfsWorkbench.TaskBoardUI"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
    xmlns:Properties="clr-namespace:TfsWorkbench.TaskBoardUI.Properties" 
    xmlns:ValueConverters="clr-namespace:TfsWorkbench.UIElements.ValueConverters;assembly=TfsWorkbench.UIElements" 
    mc:Ignorable="d"
    x:Class="TfsWorkbench.TaskBoardUI.ViewControl"
    MinHeight="300" MinWidth="300" 
    x:Name="PART_UserControl"
    >
    <UserControl.Resources>
        <ResourceDictionary>
            <ResourceDictionary.MergedDictionaries>
                <ResourceDictionary Source="/TfsWorkbench.UIElements;Component/Resources/ApplicationStyles.xaml"/>
                <ResourceDictionary Source="Resources/ListViewStyles.xaml" />
                <ResourceDictionary Source="Resources/CellDataTemplates.xaml" />
                <ResourceDictionary Source="Resources/CommonElements.xaml"/>
                <ResourceDictionary Source="Resources/ExpanderStyles.xaml"/>
                <ResourceDictionary Source="/TfsWorkbench.UIElements;Component/Resources/CommandButtonStyles.xaml"/>
            </ResourceDictionary.MergedDictionaries>
            <ValueConverters:InvertBoolean x:Key="InvertBooleanConverter" />
        </ResourceDictionary>
    </UserControl.Resources>
	<DockPanel>
		<Border
			CornerRadius="5" 
			Effect="{DynamicResource DropShadowLevel1}" 
			Background="{DynamicResource ToolbarBackground}" 
			Padding="10" 
			VerticalAlignment="Top" DockPanel.Dock="Top" 
			>
			<DockPanel Height="25">
				<Button 
					DockPanel.Dock="Left"
					CommandParameter="{Binding SwimLaneView.ViewMap, ElementName=PART_UserControl}" 
					Command="{x:Static UIElements:CommandLibrary.EditViewCommand}"
					CommandTarget="{Binding RelativeSource={RelativeSource Self}}" 
					Style="{DynamicResource EditButtonStyle}" 
					ToolTip="{x:Static Properties:Resources.String008}"
	                />
				<WrapPanel Margin="0,0,0,2" HorizontalAlignment="Right" DockPanel.Dock="Right">
                    <Button 
						x:Name="PART_CreateParent"
						CommandParameter="{Binding SelectedValue, ElementName=PART_ParentSelector}" 
						Command="{x:Static UIElements:CommandLibrary.CreateParentCommand}"
						CommandTarget="{Binding RelativeSource={RelativeSource Self}}" 
						Style="{DynamicResource AddButtonStyle}" 
                        ToolTip="{x:Static Properties:Resources.String009}"
    	                />
                    <ComboBox
                        x:Name="PART_ParentSelector"
                        ItemsSource="{Binding SwimLaneView.ViewMap.ParentTypes, ElementName=PART_UserControl}"
                        SelectedIndex="0"
                        ToolTip="{x:Static Properties:Resources.String010}"
                        />
                    <Rectangle 
                        Width="1"
                        Stroke="#ff303030"
                        Margin="2,-2,2,-2"
                        />
                    <Button
                        Command="{x:Static TaskBoardUI:LocalCommandLibrary.NewWindowCommand}"
                        CommandParameter="{Binding SwimLaneView, ElementName=PART_UserControl}"
                        CommandTarget="{Binding RelativeSource={RelativeSource Self}}"
                        ToolTip="{x:Static Properties:Resources.String023}"
                        Style="{DynamicResource NewWindowButtonStyle}"
                        />
                    <Button
                        Name="PART_ResetButton"
                        Command="{x:Static TaskBoardUI:LocalCommandLibrary.ResetCommand}"
                        CommandParameter="{x:Null}"
                        CommandTarget="{Binding RelativeSource={RelativeSource Self}}"
                        ToolTip="{x:Static Properties:Resources.String012}"
                        Content="{x:Static Properties:Resources.String013}"
                        Style="{DynamicResource RefreshButtonStyle}"
                        />
					<TaskBoardUI:ViewSorter 
						x:Name="PART_ViewSorter"
						View="{Binding SwimLaneView, ElementName=PART_UserControl}" 
						Margin="1,0" 
						ToolTip="{x:Static Properties:Resources.String014}"
		                />
					<Slider 
                        x:Name="PART_ScaleSlider" 
                        Minimum="0.5" 
                        Maximum="1.5" 
                        Width="150" 
                        Value="{Binding Source={x:Static Properties:Settings.Default}, Path=BoardScale}" 
                        Height="25" 
                        ToolTip="{x:Static Properties:Resources.String017}"
                        />
                    <Button
                        Command="{x:Static UIElements:CommandLibrary.SystemShellCommand}"
						CommandTarget="{Binding RelativeSource={RelativeSource Self}}" 
                        CommandParameter="{Binding Source={x:Static Properties:Settings.Default}, Path=HelpPageUrl}"
                        Style="{DynamicResource QuestionButtonStyle}"
                        ToolTip="{x:Static Properties:Resources.String011}"
                        />
                </WrapPanel>
				<TextBlock 
					x:Name="PART_DescriptionText" 
					VerticalAlignment="Center" 
					FontWeight="Bold" 
					Text="{Binding SwimLaneView.ViewMap.Description, ElementName=PART_UserControl}" 
					Margin="5,0,5,0"
					DockPanel.Dock="Left"
                    TextTrimming="CharacterEllipsis"
					/>
			</DockPanel>
		</Border>
        
		<Expander
			x:Name="PART_OtherItemsExpander" 
			ExpandDirection="Down"
			IsExpanded="False"
			BorderThickness="0"
			VerticalAlignment="Top"
			Style="{StaticResource OtherItemsExpander}"
            DockPanel.Dock="Top" 
            Margin="4,0,0,0"
            >
			<Expander.Header>
                <TextBlock><Run Text="{x:Static Properties:Resources.String018}" /></TextBlock>
			</Expander.Header>
			<ListView 
				x:Name="PART_OtherItemsListView" 
				DockPanel.Dock="Top" 
				Style="{StaticResource OtherItemListView}"
                >
				<ListView.View>
					<GridView x:Name="PART_OtherItemsGridView" AllowsColumnReorder="False" />
				</ListView.View>
				<ListView.LayoutTransform>
					<ScaleTransform ScaleX="{Binding Value, ElementName=PART_ScaleSlider}" ScaleY="{Binding Value, ElementName=PART_ScaleSlider}" />
				</ListView.LayoutTransform>
			</ListView>
		</Expander>
		
		<ListView
			x:Name="PART_MainListView" 
			ItemsSource="{Binding SwimLaneView.SwimLaneRows, ElementName=PART_UserControl}"
			Style="{StaticResource MainListViewStyle}" 
            ScrollViewer.CanContentScroll="{Binding Source={x:Static Properties:Settings.Default}, Path=UseSmoothScrolling, Converter={StaticResource InvertBooleanConverter}}"
			DockPanel.Dock="Top"
            >
			<ListView.View>
				<GridView x:Name="PART_MainGridView" />
			</ListView.View>
			<ListView.LayoutTransform>
				<ScaleTransform ScaleX="{Binding Value, ElementName=PART_ScaleSlider}" ScaleY="{Binding Value, ElementName=PART_ScaleSlider}" />
			</ListView.LayoutTransform>
		</ListView>
	</DockPanel>
</UserControl>
